package com.iyundao.io.mapper;

import com.iyundao.io.model.PermissionDept;
import org.springframework.stereotype.Repository;

import static org.apache.ibatis.jdbc.SqlBuilder.*;

@Repository
public class PermissionDeptSqlProvider {

    public String insertSelective(PermissionDept record) {
        BEGIN();
        INSERT_INTO("permission_dept");
        
        if (record.getSid() != null) {
            VALUES("sid", "#{sid,jdbcType=CHAR}");
        }
        
        if (record.getPid() != null) {
            VALUES("pid", "#{pid,jdbcType=CHAR}");
        }
        
        if (record.getDid() != null) {
            VALUES("did", "#{did,jdbcType=CHAR}");
        }
        
        return SQL();
    }

    public String updateByPrimaryKeySelective(PermissionDept record) {
        BEGIN();
        UPDATE("permission_dept");
        
        if (record.getPid() != null) {
            SET("pid = #{pid,jdbcType=CHAR}");
        }
        
        if (record.getDid() != null) {
            SET("did = #{did,jdbcType=CHAR}");
        }
        
        WHERE("sid = #{sid,jdbcType=CHAR}");
        
        return SQL();
    }
}